<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>队列</title>
  </head>
  <body>
    <script>
      // 队列特性: 先进先出，后进后出
      const queue = []
      queue.push("小册一姐")
      queue.push("小册二姐")
      queue.push("小册三姐")

      while (queue.length) {
        // 单纯访问队头元素（不出队）
        const top = queue[0]
        console.log(top, "取餐")
        // 将队头元素出队
        queue.shift()
      }

      // 队空
      queue // []
    </script>
  </body>
</html>
